import React, { Suspense } from 'react';
import { Router, Route, Switch, Redirect } from 'react-router-dom'
import { Spin } from 'antd';
// 引入加载路由视图得函数组件
import RouterView from '@/router/index'
// 引入路由配置表
import config from '@/router/config'
import history from '@/router/history.js';
import './App.less';

const App = () => (
  <Suspense fallback={<Spin/>}>
    <Router history={ history }>
      <Switch>
        <Route exact path="/" render={() => <Redirect to="/Login" push />} />        
        {/* 加载/展示路由视图组件 */}
        <RouterView routes={config} />
      </Switch>
    </Router>
  </Suspense>
);

export default App;